home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 26 / AMIGAplus Sonderheft 26 (2000)(Falke)(DE)(Track 1 of 2)[!].iso / Tools / Packer / xfd / Developer / autodoc / xfdApplications.doc next >
Text File  |  1999-03-29  |  5KB  |  118 lines

  1.  
  2.                      Using XFD In Own Applications
  3.                      -----------------------------
  4.  
  5. This guide describes the usual way how to use xfdmaster.library from your
  6. own applications. Read the autodocs for further information.
  7.  
  8. If you want to decrunch files from a buffer, do it like this:
  9.  
  10. 1.  Call xfdAllocObject() with XFDOBJ_BUFFERINFO (V36). If not successful,
  11.     go on with 12.
  12. 2.  Get file size, allocate buffer with that size and load file to buffer.
  13.     If not successful, go on with 10.
  14. 3.  Call xfdRecogBuffer() with xfdbi_SourceBuffer and xfdbi_SourceBufLen
  15.     initialized. You may also specify some flags in xfdbi_Flags (V37).
  16.     If not successful, file is not crunched and you may work with that
  17.     file as it is, release the used memory and go on with 10.
  18. 4.  Check xfdbi_PackerFlags for XFDPFB_PASSWORD or XFDPFB_KEY16/32 (V35),
  19.     go on with 6. if not set.
  20. 5.  Get password (maximum length is stored in xfdbi_MaxSpecialLen) or
  21.     the required 16/32 bit key and store a pointer to it in xfdbi_Special.
  22.     If xfdbi_MaxSpecialLen is -1 then password length is not limited.
  23. 5a. Initialize xfdbi_TargetBufMemType.
  24.     or:
  25. 5b. (V38) Allocate own buffer with xfdbi_MinTargetLen bytes and initialize
  26.     xfdbi_UserTargetBuf and xfdbi_UserTargetBufLen.
  27. 6.  Call xfdDecrunchBuffer(). If not successful, work with crunched file,
  28.     release memory afterwards and go on with 10 or 9b (V38).
  29. 7.  Release memory of xfdbi_SourceBuffer.
  30. 8.  Work with decrunched file.
  31. 9a. Release memory of xfdbi_TargetBuffer.
  32.     or:
  33. 9b. (V38) Release memory of xfdbi_UserTargetBuf.
  34. 10. If you have another file to decrunch, step back to 2.
  35. 11. Call xfdFreeObject() (V36).
  36. 12. Exit!
  37.  
  38. If you want to decrunch a segment list, do it like this:
  39.  
  40. 1.  Call xfdAllocObject() with XFDOBJ_SEGMENTINFO (V36). If not successful,
  41.     go on with 11.
  42. 2.  dos.library/LoadSeg() file. If not successful, go on with 9.
  43. 3.  Call xfdRecogSegment() with xfdsi_SegList and optional xfdsi_Flags (V37)
  44.     initialized. If not successful, seglist isn't crunched and you may go
  45.     on with 7.
  46. 4.  Check xfdsi_PackerFlags for XFDPFB_PASSWORD or XFDPFB_KEY16/32 (V35).
  47.     If set, get password (maximum length is stored in xfdsi_MaxSpecialLen)
  48.     or 16/32 bit key and store a pointer to it in xfdsi_Special.
  49.     If xfdsi_MaxSpecialLen is -1 then password length is not limited.
  50. 5.  (V34) Check xfdsi_PackerFlags for XFDPFB_RELMODE. If set, init
  51.     xfdsi_RelMode with the desired value.
  52. 6.  Call xfdDecrunchSegment(). If not successful, test xfdsi_SegList.
  53.     If this field contains NULL, no seglist is available anymore. You
  54.     have to dos.library/LoadSeg() the file again then.
  55. 7.  Work with segment list.
  56. 8.  dos.library/UnloadSeg() segment list.
  57. 9.  If you have another segment list to decrunch, step back to 2.
  58. 10. Call xfdFreeObject() (V36).
  59. 11. Exit!
  60.  
  61. If you only want to test if one or more files are crunched without
  62. decrunching it afterwards, here's a way to do this:
  63.  
  64. 1.  Call xfdAllocObject() with XFDOBJ_BUFFERINFO (V36). If not successful,
  65.     go on with 9.
  66. 2.  Get minimum buffer size for recognition from xfdm_MinBufferSize (V36),
  67.     allocate buffer with that size and initialize xfdbi_SourceBuffer
  68.     and xfdbi_SourceBufLen. On error goto 8.
  69. 3.  Read as many bytes from the file as fit in xfdbi_SourceBuffer.
  70.     If file is shorter than xfdm_MinBufferSize, set real length in
  71.     xfdbi_SourceBufLen. If reading fails, goto 6.
  72. 4.  Call xfdRecogBuffer(). If not successful, file is not crunched.
  73.     Go on with 6 then.
  74. 5.  Print information about cruncher or something similar.
  75. 6.  If you have another file to test, step back to 3.
  76. 7.  Release memory of xfdbi_SourceBuffer.
  77. 8.  Call xfdFreeObject() (V36).
  78. 9.  Exit!
  79.  
  80. If you want to unlink two files, do it like this:
  81.  
  82. 1.  Call xfdAllocObject() with XFDOBJ_LINKERINFO (V36). If not successful,
  83.     go on with 9.
  84. 2.  Get file size, allocate buffer with that size and load file to buffer.
  85.     If not successful, go on with 7.
  86. 3.  Call xfdRecogLinker() with xfdli_Buffer and xfdli_BufLen initialized.
  87.     If not successful, file is not linked. Go on with 6 then.
  88. 4.  Call xfdUnlink(). If not successful, go on with 6.
  89. 5.  Do something with unlinked files.
  90. 6.  Release memory of xfdli_Buffer.
  91. 7.  If you have another file to unlink, step back to 2.
  92. 8.  Call xfdFreeObject() (V36).
  93. 9.  Exit!
  94.  
  95. If you only want to test if a file is a linked one without unlinking
  96. it afterwards, here's a way to do this:
  97.  
  98. 1.  Call xfdAllocObject() with XFDOBJ_LINKERINFO (V36). If not successful,
  99.     go on with 9.
  100. 2.  Get minimum buffer size for recognition from xfdm_MinLinkerSize (V36),
  101.     allocate buffer with that size and initialize xfdli_Buffer and
  102.     xfdli_BufLen. On error goto 8.
  103. 3.  Read as many bytes from the file as fit in xfdli_Buffer.
  104.     If file is shorter than xfdm_MinLinkerSize, set real length in
  105.     xfdli_BufLen. If reading fails, goto 6.
  106. 4.  Call xfdRecogLinker(). If not successful, file is not linked.
  107.     Go on with 6 then.
  108. 5.  Print information about linker or something similar.
  109. 6.  If you have another file to test, step back to 3.
  110. 7.  Release memory of xfdli_Buffer.
  111. 8.  Call xfdFreeObject() (V36).
  112. 9.  Exit!
  113.  
  114. Whenever you intend to use a feature of the xfdmaster.library that is
  115. marked (V34) or higher, make sure that you use this version number
  116. during the exec.library/OpenLibrary() call. Otherwise, if you try to
  117. use new features with an old library version, the system might crash.
  118.